<template id="new_people">
    <div class="try_m">
        <div class="new_people_top">
            <img src="../image/blue_da.png" alt="" @click="get_tui()">
            <h4>新人礼</h4>
        </div>
         <div class="new_people_1">
             <img src="../image/new_1.png" alt="">
             <img src="../image/new_2.png" alt="" @click="Red_coupon()">
         </div>
        <div class="new_people_2">
                <div class="new_people_2_1">新人特权产品</div>
                <div class="new_people_2_2">
                    <div class="new_people_2_3">
                        <div class="new_bu_mmg" v-for="item in items">
                            <div class="new_li_st">
                                <div class="new_x_m"><img class="img_l1"  :src="item.thumb" alt="" @click="getDetail(item.goods_id)"></div>
                                <div class="new_x_right">
                                    <h2 @click="getDetail(item.goods_id)">{{item.goods_name}}</h2>
                                    <p @click="getDetail(item.goods_id)">{{item.goods_brief}}</p>
                                    <p>原价{{item.activity_price}}</p>
                                    <p>新人价:¥{{item.shop_price}}</p>
                                    <p>每人限购一份</p>
                                    <div class="new_Select_price"><img src="../image/gou.png" alt=""  @click="getDetail(item.goods_id)"></div>
                                </div>
                            </div>
                        </div>

                    </div>
                </div>
        </div>
         <div class="new_people_3">
             <img src="../image/new_5.png" alt="">
         </div>
    </div>
</template>
<script>
    export default{
        name: 'new_people',
        data() {
            return {
                items:[]
            }
        },
        mounted:function () {
            let H=$(window).height();
            $('.try_m').height(H);

            //新人礼
            this.new_user_gift();

            //新人红包
            this.coupon();
        },
        methods:{
            new_user_gift:function(order_id){ 

                //赠送 新人礼
                let url  = this.GLOBAL.BaseUrl+'/mobile/api/v1/Public.php?mode=new_user_gift';
                let Data = this.GLOBAL.dataParam();
                
                this.$ajax.post(url,Data).then((res) => {
                    let temp = res.data;
                    if(temp.code == 200){
                        this.items = temp.data;        
                    }  
                })              
                
            },
            coupon:function(order_id){ 

                //赠送 新人礼
                let url  = this.GLOBAL.BaseUrl+'/mobile/api/v1/Public.php?mode=coupon_api';
                let Data = this.GLOBAL.dataParam();
                
                this.$ajax.post(url,Data).then((res) => {
                    let temp = res.data;
                    if(temp.code != 200){
                        this.GLOBAL.center_error(this,temp);        
                    }  
                })              
                
            },
            get_tui:function(){
                window.history.go(-1);
            },
            addCart:function(goods_id,image, number = 1){
                this.GLOBAL.addCart(this,goods_id,number);
                this.GLOBAL.get_te(image)
            },
            getDetail:function(id){
                this.$router.push('/shopDetails?goods_id='+id);
            },
            Red_coupon:function(){
                this.$router.push('Red_coupon');
            },
        },

    };

</script>
<style>
    .new_people_3{
        width:100%;
        height:0.98rem;
    }
    .new_people_3 img{
        display:block;
        width:100%;
        height:0.98rem;
    }
    .new_people_2_3 .new_bu_mmg:last-of-type{
        border-bottom:0;
    }
    .new_bu_mmg{
        height:2.4rem;
        width:100%;
        border-bottom:0.01rem solid #f0f0f0;
    }
    .new_li_st{
        height:2.4rem;
        width:5.95rem;
        margin:0 auto;
        display:flex;
        /*   flex-wrap: wrap;*/
        justify-content:flex-start;
        /*  border-bottom:0.01rem solid #f0f0f0;*/
    }
    .new_Select_price{
        height:0.68rem;
        position:relative;
        top:-0.6rem;
    }
    .new_Select_price span{
        display:block;
        color:#fc1dac;
        font-size:0.18rem;
        width:2rem;
        height:0.68rem;
        line-height:0.68rem;
    }
    .new_Select_price strong{
        font-size:0.24rem;
    }
    .new_Select_price img{
        display:block;
        position:absolute;
        top: -0.1rem;
        right:0.2rem;
        height:0.6rem;
        width:0.6rem;
    }
    .new_x_m{
        /* flex:1;*/
        height:1.8rem;
        width:2.12rem;
        padding-top:0.6rem;
    }
    .new_x_m img{
         display:block;
        width:1.54rem;
        height:1.54rem;
        margin:0 auto;
    }
    .new_x_right{
        height: 1.9rem;
        width:3.84rem;
        /* flex: 1;*/
        padding-top: 0.5rem
    }
    .new_x_right h2{
        height:0.42rem;
        color:#4a4a4a;
        font-size:0.28rem;
        line-height:0.25rem;
        font-weight:normal;
    }
    .new_x_right p:nth-of-type(4){
        height:0.35rem;
        color:#1da9fe;
        font-size:0.2rem;
        line-height:0.35rem;
    }
    .new_x_right p:nth-of-type(3){
        height:0.39rem;
        color:#fc1dac;
        font-size:0.18rem;
        line-height:0.39rem;
    }
    .new_x_right p:nth-of-type(2){
        height:0.32rem;
        color:#cdcdcd;
        font-size:0.18rem;
        line-height:0.32rem;
        text-decoration: line-through;
    }
    .new_x_right p:nth-of-type(1){
        height:0.35rem;
        color:#bababa;
        font-size:0.19rem;
        line-height:0.19rem;
    }
    /*商品列表*/
    .new_people_2_3{
        width:6rem;
        height:7.39rem;
        background:#ffffff;
    }
    .new_people_2_2{
        width:6rem;
        height:7.39rem;
        margin:0 auto;
        background:url(../image/new_3.png) no-repeat;
        background-size: contain;
        padding:0.1rem;
    }
    .new_people_2_1{
        width:5.4rem;
        height:1rem;
        line-height:1rem;
        text-align:center;
        font-size:0.46rem;
        color:#ffffff;
        margin:0 auto;
        background:url(../image/new_4.png) no-repeat;
        background-size:contain;
    }
    .new_people_2{
        width:100%;
        min-height:8.86rem;
        background:#6bb8f9;
        /*background:url(../image/new_3.png) no-repeat;
        background-size: contain;*/
    }
    /*2*/
    .new_people_1 img:nth-of-type(2){
        display:block;
        position:absolute;
        width:3.25rem;
        height:0.63rem;
        bottom:1.2rem;
        left:1.6rem;
    }
    .new_people_1 img:nth-of-type(1){
        display:block;
        width:100%;
        height:8.18rem;
    }
    .new_people_1{
        width:100%;
        height:8.18rem;
        position:relative;
    }
    /*1*/
    .new_people_top{
        height:0.75rem;
        width:100%;
       /* border-bottom:1px solid #f0f0f0;*/
        position:relative;
        background:#ffffff;
    }
    .new_people_top img{
        height:0.36rem;
        width:0.36rem;
        display:block;
        position:absolute;
        left:0.25rem;
        top:0.2rem;
    }
    .new_people_top h4{
        height:0.75rem;
        color:#2eaffc;
        font-size:0.3rem;
        line-height:0.75rem;
        text-align:center;
        font-weight:normal;
    }
</style>
